package com.example.doublewrite.controller;



import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.doublewrite.mapper.OrderItemMapper;
import com.example.doublewrite.mapper.OrderMapper;
import com.example.doublewrite.model.Order;
import com.example.doublewrite.model.OrderDTO;
import com.example.doublewrite.model.OrderItem;
import com.example.doublewrite.service.MerchantOrderService;
import com.example.doublewrite.service.UserOrderService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@RestController
public class OrderController {
    @Autowired
    private UserOrderService userOrderService;
    @Autowired
    private MerchantOrderService merchantOrderService;

    @GetMapping("/user/create")
    public void createOrder() {
        userOrderService.createOrder();
    }

    @GetMapping("/user/order-list/{userId}")
    public Object getOrderListByUserId(@PathVariable("userId") Long userId) {
        return userOrderService.getOrderListByUserId(userId);
    }

    @GetMapping("/merchant/order-list/{merchantId}")
    public Object getOrderListByMerchantId(@PathVariable("merchantId") Long merchantId) {
        return merchantOrderService.getOrderListByMerchantId(merchantId);
    }

}
